package com.becca.cake.model.activity;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.becca.cake.core.exception.ServiceException;
import com.becca.cake.model.order.OrderModel;


/**
 * 企业试吃申请表
 * @copyright  尊星(上海)信息科技有限公司
 * @author hejinguo
 * @date 2016年7月20日 下午1:08:28
 */
public class CompanyEatApplyModel implements Serializable {

    /**  */
    private static final long  serialVersionUID              = 5617076061534340181L;

    /**是否已联系(1:已联系)*/
    public static final Byte   IS_CONNECTION_YES             = 1;

    /**申请状态(0:申请中)*/
    public static final Byte   APPLY_STATUS_APPLYING         = 0;
    /**申请状态(1:已通过)*/
    public static final Byte   APPLY_STATUS_PASS             = 1;
    /**申请状态(2:不通过)*/
    public static final Byte   APPLY_STATUS_NO_PASS          = 2;
    /**申请状态(3:已下单)*/
    public static final Byte   APPLY_STATUS_ORDER            = 3;
    /**试吃申请信息不存在*/
    public static final String COMPANY_MODEL_NULL            = "申请试吃信息不存在";
    /**申请试吃编号不能为空*/
    public static final String COMPANY_ID_NULL               = "申请试吃编号不能为空";
    /**公司名称不能为空*/
    public static final String COMPANY_NAME_NULL             = "公司名称不能为空";
    /**公司名称不能为空*/
    public static final String COMPANY_ADDRESS_NULL          = "公司地址不能为空";
    /**试吃人数不能为空*/
    public static final String COMPANY_EMPLOYEE_NUM_NULL     = "试吃人数不能为空";
    /**申请人部门不能为空*/
    public static final String COMPANY_APPLY_DEPARTMENT_NULL = "申请人部门不能为空";
    /**申请人不能为空*/
    public static final String COMPANY_APPLY_USER_NAME_NULL  = "申请人不能为空";
    /**申请人电话不能为空*/
    public static final String COMPANY_USER_PHONE_NULL       = "申请人电话不能为空";
    /**公司电话不能为空*/
    public static final String COMPANY_TEL_NULL              = "公司电话不能为空";
    /**商品编号不能为空*/
    public static final String COMPANY_GOODS_PRICE_SIZE_NULL = "商品编号不能为空";
    /**未勾选需要导出的数据*/
    public static final String IDS_NULL                      = "未勾选需要导出的数据";

    /**该申请已被通过处理*/
    public static final String APPLY_PASSED                  = "该申请已被通过处理";

    /**该申请已被未通过处理*/
    public static final String APPLY_NOT_PASSED              = "该申请已被未通过处理";

    /**该申请已被下单处理*/
    public static final String APPLY_ORDER                   = "该申请已被下单处理";

    /**ID*/
    private Integer            id;
    /**公司名*/
    private String             companyName;
    /**公司地址*/
    private String             companyAddress;
    /**试吃人数*/
    private Integer            employeeNum;
    /**申请部门*/
    private String             applyDepartment;
    /**申请人*/
    private String             applyUserName;
    /**申请人手机号*/
    private String             applyUserPhone;
    /**公司电话*/
    private String             companyTel;
    /**公司邮箱*/
    private String             companyEmail;
    /**公司规模*/
    private String             companyScale;
    /**产品规格ID*/
    private Integer            goodsPriceSizeId;
    /**申请状态(0:申请中 1:申请通过 2:申请不通过3:已下单)*/
    private Byte               applyStatus;

    /**企业试吃申请状态多值(0:申请中 1:申请通过 2:申请不通过3：已下单)*/
    private String             applyStatusArray;

    /**是否已联系(0:未联系 1:已联系)*/
    private Byte               isConnection;
    /**联系时间*/
    private Date               connectionDate;
    /**申请不通过原因*/
    private String             noPassReason;
    /**申请通过后对应的订单号*/
    private Integer            orderId;

    /**创建时间*/
    private Date               createdDate;
    /**创建人*/
    private String             createdName;
    /**修改时间*/
    private Date               updatedDate;
    /**修改人*/
    private String             updatedName;

    /**
     *保存提交申请数据校验
     * @param companyEatApplyModel
     */
    public static void validateSaveCompanyEatApply(CompanyEatApplyModel companyEatApplyModel) {
        if (companyEatApplyModel == null) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_MODEL_NULL);
        }
        if (companyEatApplyModel.getId() == null) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_ID_NULL);
        }
        if (StringUtils.isEmpty(companyEatApplyModel.getCompanyName())) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_NAME_NULL);
        }
        if (StringUtils.isEmpty(companyEatApplyModel.getCompanyAddress())) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_ADDRESS_NULL);
        }
        if (companyEatApplyModel.getEmployeeNum() == null) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_EMPLOYEE_NUM_NULL);
        }
        if (StringUtils.isEmpty(companyEatApplyModel.getApplyDepartment())) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_APPLY_DEPARTMENT_NULL);
        }
        if (StringUtils.isEmpty(companyEatApplyModel.getApplyUserName())) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_APPLY_USER_NAME_NULL);
        }
        if (StringUtils.isEmpty(companyEatApplyModel.getApplyUserPhone())) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_USER_PHONE_NULL);
        }
        if (StringUtils.isEmpty(companyEatApplyModel.getCompanyTel())) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_TEL_NULL);
        }
    }

    /**
     * 申请状态修改校验
     * @param companyEatApplyModel
     */
    public static void validateUpdateApplyStatus(Integer id) {
        if (id == null) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_ID_NULL);
        }
    }

    /**
     * 企业试吃通过数据验证
     * @param id
     * @param goodsPriceSizeId
     */
    public static void validateCompanyEatApplyPassParam(Integer id, Integer goodsPriceSizeId,
                                                        String deliveryDate, String deliveryTimes) {
        if (id == null) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_ID_NULL);
        }
        if (goodsPriceSizeId == null) {
            throw new ServiceException(CompanyEatApplyModel.COMPANY_GOODS_PRICE_SIZE_NULL);
        }
        if (StringUtils.isEmpty(deliveryDate)) {
            throw new ServiceException(OrderModel.DELIVERY_DATE_IS_NULL);
        }
        if (StringUtils.isEmpty(deliveryTimes)) {
            throw new ServiceException(OrderModel.DELIVERY_TIMES_IS_NULL);
        }

    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCompanyAddress() {
        return companyAddress;
    }

    public void setCompanyAddress(String companyAddress) {
        this.companyAddress = companyAddress;
    }

    public Integer getEmployeeNum() {
        return employeeNum;
    }

    public void setEmployeeNum(Integer employeeNum) {
        this.employeeNum = employeeNum;
    }

    public String getApplyDepartment() {
        return applyDepartment;
    }

    public void setApplyDepartment(String applyDepartment) {
        this.applyDepartment = applyDepartment;
    }

    public String getApplyUserName() {
        return applyUserName;
    }

    public void setApplyUserName(String applyUserName) {
        this.applyUserName = applyUserName;
    }

    public String getApplyUserPhone() {
        return applyUserPhone;
    }

    public void setApplyUserPhone(String applyUserPhone) {
        this.applyUserPhone = applyUserPhone;
    }

    public String getCompanyTel() {
        return companyTel;
    }

    public void setCompanyTel(String companyTel) {
        this.companyTel = companyTel;
    }

    public Byte getApplyStatus() {
        return applyStatus;
    }

    public void setApplyStatus(Byte applyStatus) {
        this.applyStatus = applyStatus;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public String getCreatedName() {
        return createdName;
    }

    public void setCreatedName(String createdName) {
        this.createdName = createdName;
    }

    public Date getUpdatedDate() {
        return updatedDate;
    }

    public void setUpdatedDate(Date updatedDate) {
        this.updatedDate = updatedDate;
    }

    public String getUpdatedName() {
        return updatedName;
    }

    public void setUpdatedName(String updatedName) {
        this.updatedName = updatedName;
    }

    public Integer getGoodsPriceSizeId() {
        return goodsPriceSizeId;
    }

    public void setGoodsPriceSizeId(Integer goodsPriceSizeId) {
        this.goodsPriceSizeId = goodsPriceSizeId;
    }

    public String getNoPassReason() {
        return noPassReason;
    }

    public void setNoPassReason(String noPassReason) {
        this.noPassReason = noPassReason;
    }

    public Integer getOrderId() {
        return orderId;
    }

    public void setOrderId(Integer orderId) {
        this.orderId = orderId;
    }

    public Byte getIsConnection() {
        return isConnection;
    }

    public Date getConnectionDate() {
        return connectionDate;
    }

    public void setIsConnection(Byte isConnection) {
        this.isConnection = isConnection;
    }

    public void setConnectionDate(Date connectionDate) {
        this.connectionDate = connectionDate;
    }

    public String getCompanyEmail() {
        return companyEmail;
    }

    public void setCompanyEmail(String companyEmail) {
        this.companyEmail = companyEmail;
    }

    public String getCompanyScale() {
        return companyScale;
    }

    public void setCompanyScale(String companyScale) {
        this.companyScale = companyScale;
    }

    public String getApplyStatusArray() {
        return applyStatusArray;
    }

    public void setApplyStatusArray(String applyStatusArray) {
        this.applyStatusArray = applyStatusArray;
    }

}
